package org.xserver.component.exception;

import org.jboss.netty.handler.codec.http.HttpResponseStatus;

/**
 * @author bin
 * @since 2016-04-07
 */
public class SslFilterError extends FilterProcessError {

	public SslFilterError(SslFilterErrorEnum sslFilterErrorEnum) {
		super(SslFilterError.class.getSimpleName(), sslFilterErrorEnum.getValue());
		setCode(String.valueOf(HttpResponseStatus.FORBIDDEN.getCode()));
	}


	public SslFilterError(String message) {
		super(SslFilterError.class.getSimpleName(), message);
	}

	public SslFilterError(String filterName, String message) {
		super(filterName, message);
	}

	public SslFilterError(String filterName, String errorCode, String errorMessage) {
		super(filterName, errorMessage);
		setCode(errorCode);
	}

	public enum SslFilterErrorEnum {
		NeedHttp("此接口需要通过HTTP进行访问"),
		NeedSsl("此接口需要通过HTTPS进行访问");
		private final String value;

		SslFilterErrorEnum(String value) {
			this.value = value;
		}

		public String getValue() {
			return value;
		}
	}
}
